package org.shock.ss.sms.commons.utils;

import java.lang.reflect.Method;

public class ReflexUtils {
	public static String rwritertoString(Object obj) {
		Method[] ms = obj.getClass().getMethods();
		StringBuffer sb = new StringBuffer();
		try {
			for (Method method : ms) {
				method.setAccessible(true);
				if (method.getName().startsWith("get")
						|| method.getName().startsWith("is")) {
					sb.append(method.getName().replace("get", "") + ":"
							+ method.invoke(obj, null) + "  ");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return sb.toString();
	}
}
